package com.java.lang.clon;

import java.util.Date;

import com.xa.common.utils.json.JsonUtils;

/**
 * @author Ben
 *
 * @date 2018年4月10日
 */
public class DeepCopy implements Cloneable {
    private Date begin;

    public Date getBegin() {
        return this.begin;
    }

    public void setBegin(Date d) {
        this.begin = d;
    }

    public Object clone() {
        DeepCopy obj = null;
        try {
            obj = (DeepCopy) super.clone();
        } catch (CloneNotSupportedException ex) {
            ex.printStackTrace();
        }
        obj.setBegin((Date) this.getBegin().clone());
        return obj;
    }

    public static void main(String[] args) {
        DeepCopy dc = new DeepCopy();
        DeepCopy copy = (DeepCopy) dc.clone();
        System.out.println(JsonUtils.object2String(copy));
    }
}
